#include "graph.h"



Plot::Plot( const char* name, const char* axis_x_name, const char* axis_y_name, bool show_legend, QWidget* parent ): QwtPlot( parent )
{
	setTitle( name );

	legend = 0;
	if ( show_legend )
	{
		legend = new QwtLegend();
		insertLegend( legend, QwtPlot::RightLegend );
	}

	setAxisTitle( xBottom, axis_x_name );
	setAxisTitle( yLeft, axis_y_name );

	//white background
	setCanvasBackground( QColor( 255, 255, 255 ) );
    
	mY = new QwtPlotMarker();
	mY->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
	mY->setLineStyle( QwtPlotMarker::HLine );
	mY->setYValue( 0.0 );
	mY->attach( this );
};



Plot::~Plot()
{
	if ( legend != 0 )
		delete legend;
	delete mY;
};